package com.goodving.guli.bt.weight.family;

import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;

import com.goodving.guli.R;
import com.goodving.guli.bt.DimPanelFragment;
import com.goodving.guli.bt.ui.DimPanelBottomBar;
import com.goodving.guli.model.Keeper;

/**
 * Created by john on 2015/12/16.
 */
public class C1841l extends DimPanelFragment {
    public static final String f10280a = "TITLE";
    public static final String f10281b = "CONTENT";
    public static final String f10282c = "NEGATIVETEXT";
    public static final String f10283d = "POSITIVETEXT";
    private static final String f10284i = "BabyWeightFirstInFragment";
    private TextView f10285e;
    private TextView f10286f;
    private CheckBox f10287g;
    private DimPanelBottomBar f10288h;
    private String f10289j;
    private String f10290k;
    private String f10291l;
    private String f10292m;
    private C1843n f10293n;
    private boolean f10294o;

    public C1841l() {
        this.f10294o = false;
    }

    public void m14893a(C1843n c1843n) {
        this.f10293n = c1843n;
    }

    protected int inflateLayout() {
        return R.layout.fragment_babyweight;
    }

    class C1842m implements CompoundButton.OnCheckedChangeListener {
        final /* synthetic */ C1841l f10295a;

        C1842m(C1841l c1841l) {
            this.f10295a = c1841l;
        }

        public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
            this.f10295a.f10294o = z;
            Keeper.setShowBabyWeight(this.f10295a.f10294o);
        }
    }

    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        View onCreateView = super.onCreateView(layoutInflater, viewGroup, bundle);
        this.f10289j = getArguments().getString(f10280a) == null ? f10280a : getArguments().getString(f10280a);
        this.f10290k = getArguments().getString(f10281b) == null ? f10281b : getArguments().getString(f10281b);
        this.f10291l = getArguments().getString(f10282c) == null ? f10282c : getArguments().getString(f10282c);
        this.f10292m = getArguments().getString(f10283d) == null ? f10283d : getArguments().getString(f10283d);
        this.f10285e = (TextView) onCreateView.findViewById(R.id.title);
        this.f10285e.setText(this.f10289j);
        this.f10286f = (TextView) onCreateView.findViewById(R.id.content);
        this.f10286f.setText(this.f10290k);
        this.f10288h = (DimPanelBottomBar) onCreateView.findViewById(R.id.dimbtmbar);
        this.f10288h.m14981a(this.f10292m);
        this.f10288h.m14984b(this.f10291l);
        this.f10287g = (CheckBox) onCreateView.findViewById(R.id.check_text);
        this.f10287g.setOnCheckedChangeListener(new C1842m(this));
        return onCreateView;
    }

    public void onDismiss(DialogInterface dialogInterface) {
        super.onDismiss(dialogInterface);
        if (this.f10293n != null) {
            this.f10293n.m14894a();
        }
    }

    protected void onLeftButtonClicked() {
        super.onLeftButtonClicked();
        Keeper.setShowBabyWeight(this.f10294o);
        dismiss();
    }

    protected void onRightButtonClicked() {
        super.onRightButtonClicked();
        Keeper.setShowBabyWeight(this.f10294o);
        dismiss();
    }
}
